<div class="main_right_between" style="height: 1220px!important;">
    <?php if(!empty($products)):?>
        <?php
                $count = 1;
                $global = count($products);
                $reset = 1;
        ?>
        <input type="hidden" value="<?=$global?>" id="procount1" name="procount1"/>


        <?php foreach($products as $product):?>

            <?php
                if($count == 17):
                    $count = 1;
                    $reset++;
                endif;
            ?>


            <?php if($count == 1):?>
                <?php if($reset == 1):?>
                    <div id="pr1<?=$reset?>" class="page _current" style="">
                    <div class="product">
                <?php else:?>
                    <div id="pr1<?=$reset?>" class="page" style="display:none">
                    <div class="product">
                <?php endif;?>
            <?php endif;?>

    		<div class="product_new">
            <form action="" class="addcart" method="POST">
            	<div class="text_PRODUCT1">
            	   <p class="pro_name"><a href="<?=_BASE_URL?>index.php?module=product&action=detail&slug=<?=$product['slug']?>" style="color: #80F2F3!important;"><?=$this->_helper->limited_word(ucfirst($product['product_name']),5)?></a></p>
            	</div>
            	<div class="img_product">
                    <p class="img_bg">
                       <?php if(is_file("admin/".$product['product_thumb'])):?>
                    	   <a href="<?=_BASE_URL?>index.php?module=product&action=detail&slug=<?=$product['slug']?>"><img src="<?=_BASE_URL?>admin/<?=$product['product_thumb']?>" /></a>
                        <?php else:?>
                            <a href="<?=_BASE_URL?>index.php?module=product&action=detail&slug=<?=$product['slug']?>"><img src="<?=_BASE_URL?>admin/assets/uploads/images/news/imgerr.jpg" /></a>
                        <?php endif;?>
                    </p>
           		</div>
                <div style="clear: both;"></div>
            	<div class="text_PRODUCT_price">
                    <?php if($product['product_price_sale'] != 0):?>
                        <?= number_format($product['product_price_sale'],0,",",".")?> VNÐ
                    <?php else:?>
                        <?= number_format($product['product_price'],0,",",".")?> VNÐ
                    <?php endif;?>

            	</div>
                <a href="#giohang" class="product_icon cart">
                	<img src="<?=_BASE_URL?>assets/frontend/css/img/icon_muahng.png" />
                </a>
                <a href="<?=_BASE_URL?>index.php?module=product&action=detail&slug=<?=$product['slug']?>" class="product_icon1">
                	<img src="<?=_BASE_URL?>assets/frontend/css/img/icon_chitiet.png" />
                </a>
                <input type="hidden" value="<?=$product['product_id']?>" name="product_id" />
            </form>
            </div><!--End of .product_new -->


            <?php if($count == $global || $count == 16 || ($count + ($reset-1)*16) == $global  ) :?>
                </div><!--End of .product -->
                </div>
            <?php endif;?>

            <?php $count++?>
        <?php endforeach;?>
    <?php endif;?>

    <div style="clear: both;"></div>

    <div class="paging">
        <div class="productpaging1" style="width: 315px; margin-left: 186px"></div>
    </div><!--End of #paging -->
    <div style="clear: both;"></div>
    <div class="back"><a href="<?= _BASE_URL?>" style="margin: 10px 0 !important ;" title="Quay lại trang chủ">Back</a></div>
</div><!--End of .main_right_between -->


<script type="text/javascript">

   jQuery.noConflict();

   var countpro = jQuery('#procount1').val() ;
   //console.log(countpro);
   var perpage = countpro/16;

   if(perpage<5 || !countpro)
   {
        perpage = 5;
   }

   jQuery(".productpaging1").paginate({
				count 		: perpage,
				start 		: 1,
				display     : perpage,
				border					: false,
				text_color  			: '#888',
				background_color    	: '#EEE',
				text_hover_color  		: 'black',
				background_hover_color	: '#CFCFCF',
                mouse                   : 'press',
                onChange     			: function(page){
											jQuery('._current').removeClass('_current').hide();
											jQuery('#pr1'+page).addClass('_current').show();
										  }
	});

</script>